﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yto.Common.Dependency;
using Yto.Repositories;

namespace com.ytocargo.Core.FlightInfos
{
    public class FlightInfoStore : IFlightInfoStore, ITransient
    {
        private IBaseRepository<FlightInfo> _repository;

        public FlightInfoStore(IBaseRepository<FlightInfo> baseRepository)
        {
            _repository = baseRepository;
        }

        public IQueryable<FlightInfo> GetAll()
        {
            return _repository.GetAll();
        }

        public List<FlightInfo> GetFlightInfos(int maxCount)
        {
            return _repository.GetAll().Take(maxCount).ToList();
        }

        public IQueryable<FlightInfo> GetFlightInfosByFlightDate(DateTime flightDate)
        {
            return _repository.GetAll().Where(f => f.FlightDate == flightDate);
        }
    }
}
